//searchEnter.js
//获取应用实例
var app = getApp();
Page({
  data: {
    keywords: ''
  },
  //跳转至店铺首页
  toSearchResult: function(e) {
    this.keywords = e.currentTarget.dataset.title;
    wx.navigateTo({
      url: '../search-result/search-result?keywords='+ this.keywords
    });
  },
  //clear input
  clearInput: function(e){
    this.keywords = '';
    this.setData({
      keywords: this.keywords
    });
  },
  //实时变化input值
  keywordInput: function(e){
    this.keywords = e.detail.value;
  },
  //点击搜索按钮
  toSearchResultWithKey: function(e){
    wx.navigateTo({
      url: '../search-result/search-result?keywords='+ this.keywords
    });
  }
});

